package com.gupao.p7store.admin.web.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * desc:
 *
 * @ClassName: com.gupao.p7store.job.test.filter.TestFilter
 * @author: dengbicheng
 * @date: 2022-05-29 15:42
 * @version: v 1.0.0
 */
public class TestFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        TestRequestWrapper testRequestWrapper = new TestRequestWrapper((HttpServletRequest)servletRequest);
        String body = testRequestWrapper.getBodyString();
        System.out.println(body);
        filterChain.doFilter(testRequestWrapper, servletResponse);
    }

    @Override
    public void destroy() {

    }
}
